/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rule;

/**
 *
 * @author Pedro
 */
public class Length extends Clause {
    public Length(String p){
        super(p);
    }
    
    @Override
    public boolean checkConditions(){
        double limits[] = {5,8,16,18};
        int pointsForLength[] = {3,6,12,18};
        String numbersForMessage[] = {"3","6","12","18"};
        
        for(int i = 0; i < limits.length; i++)
        {
            if(getPass().length() < limits[i])
            {
                punctuate(pointsForLength[i]);
                setLog( numbersForMessage[i] + " points for length (" + getPass().length() + ")");
            }     
        }
        
        return true;
    }

    @Override
    public double punctuate(double score){
        setScore(score);
        return score;
    }

    @Override
    public String outputMessage() {
        return getLog();
    }
    
    public int count(){
        return getPass().length();
    }
}
